# -*- coding: utf-8 -*-
"""
Created on 03 08 下午4:55 2022 
@Author : HHQUAN
@Email : 1075960398@qq.com

"""

import numpy as np
import soundfile as sf
import matplotlib.pyplot as plt

sig = 0
file1 = '/media/cl/cldata/新2570相关/2022年06_17/南望采集数据/10-pxs/10pxs-micrec'
file2 = '/media/cl/cldata/新2570相关/2022年06_17/南望采集数据/10-pxs/data81/'
filelist = [1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14] # 7,8,15,16
for i, name in enumerate(filelist):
    wav, _ = sf.read(file1+str(name)+'.wav')
    fid = open(file2+'mic'+str(i)+'.pcm', 'wb')
    fid.write((wav[int(1.3e6): int(5.2e6)]*32768.0).astype(np.int16).tobytes())
    fid.close()

# plt.figure()
# plt.plot(sig[int(1.3e6): int(5.2e6)])
# plt.show()

